<?php
// $Id: forums.tpl.php,v 1.4 2007/08/07 08:39:35 goba Exp $

/**
 * @file forums.tpl.php
 * Default theme implementation to display a forum which may contain forum
 * containers as well as forum topics.
 *
 * Variables available:
 * - $links: An array of links that allow a user to post new forum topics.
 *   It may also contain a string telling a user they must log in in order
 *   to post.
 * - $forums: The forums to display (as processed by forum-list.tpl.php)
 * - $topics: The topics to display (as processed by forum-topic-list.tpl.php)
 * - $forums_defined: A flag to indicate that the forums are configured.
 *
 * @see template_preprocess_forums()
 * @see theme_forums()
 */
if($item) {
?>

<table width="255" border="1">
<tr>
  <td width="55"><img src="http://www.wowarmory.com/images/icons/51x51/<? echo $item->icon;?>.jpg" /></td>
  <td width="200">
    <?
	printf("<p class='overallQualityId%d'>%s</p>\n",$item->overallQualityId,$item->name);
	printf("<div>%s</div>\n",$item->bonding);
	printf("<div><div style='float:right'>%s</div><div>%s</div></div>\n",$item->subclassName,$item->inventoryType);
	if($item->damage) {
      printf("<div><div style='float:right'>%s</div><div>%s</div></div>\n",t("Speed ") . $item->damagespeed,$item->damage . t(" Damage"));
      printf("<div>(%0.1f %s)</div>\n",$item->damagedps,t("damage per second"));
	}
	
	

	if($item->armor) printf("<div>%s %s</div>\n",$item->armor,t("armor"));
	if($item->bonusStrength) printf("<div>%s %s</div>\n",$item->bonusStrength,t("Strength"));
	if($item->bonusAgility) printf("<div>%s %s</div>\n",$item->bonusAgility,t("Agility"));
	if($item->bonusStamina) printf("<div>%s %s</div>\n",$item->bonusStamina,t("Stamina"));
	if($item->bonusIntellect) printf("<div>%s %s</div>\n",$item->bonusIntellect,t("Intellect"));

    if($item->socketData) {
	    $tmp = '<ul>';
	    foreach($item->socketData->socket as $ele) {
		  $tmp .= '<li>' . $ele['color'] . ' socket</li>';
		}
		if($item->socketData->socketMatchEnchant) {
		  $tmp .= '<li>Matching Bonus: ' . $item->socketData->socketMatchEnchant . '</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
		
	  }

	if($item->durability) printf("<div>%s: %d / %d</div>\n",t("Durability"),$item->durability,$item->durability);
	if($item->allowableClasses) printf("<div>%s: %s</div>\n",t("Allowable classes"),$item->allowableClasses);
	if($item->requiredLevel) printf("<div>%s: %d</div>\n",t("Required level"),$item->requiredLevel);

	if($item->bonusCritRating) printf("<div>+%s %s</div>\n",$item->bonusCritRating,t("Crit Rating"));
	if($item->bonusCritSpellRating) printf("<div>+%s %s</div>\n",$item->bonusCritSpellRating,t("Spell Crit Rating"));
	if($item->bonusResilienceRating) printf("<div>+%s %s</div>\n",$item->bonusResilienceRating,t("Resiliance"));
	if($item->bonusHitSpellRating) printf("<div>+%s %s</div>\n",$item->bonusCritRating,t("Spell Hit Rating"));
	if($item->bonusHasteRating) printf("<div>+%s %s</div>\n",$item->bonusHasteRating,t("Haste Rating"));

	  // Spells
	  if($item->spellData) {
	    $tmp = '<ul>';
	    foreach($item->spellData->spell as $ele) {
		  $tmp .= '<li>' . ($ele->trigger==1?'Equip:':'Use:') . ' ' . $ele->desc . '</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
	  }
	  // Set
	  if($item->setData) {
	    $tmp = '<ul>';
		$tmp .= '<li>' . $item->setData->name . '</li>';
	    foreach($item->setData->item as $ele) {
		  $tmp .= '<li>' . $ele['name'] . '</li>';
		}
		$tmp .= "<li>Set Bonus:</li>";
	    foreach($item->setData->setBonus as $ele) {
		  $tmp .= '<li>(' . $ele['threshold'] . ') Set: ' . $ele['desc'] .'</li>';
		}
	    $tmp .= '</ul>';
		echo $tmp;
    }

//	if($item->setData) echo print_r($item->setData,true);
    ?>
  </td>
</tr>
</table>

<pre><? print_r($item); ?></pre>


<?php
} else {
	print("Item not found");
}
?>